#!/bin/sh                                                                                                                                                                                        

[ $# -gt 0 ] || { echo "input commit message!"; exit 0;}
msg=$1
echo "change is :" $msg

git st | grep "modified:" | awk '{if (NF == 2) print $NF}' |
xargs sudo git add -A

git st | grep -v "deleted:" | grep -v ".swp" |grep -v "modified:" | awk '{if (NF ==1) print $1}' |
xargs sudo git add -A

git st | grep "deleted:" | awk '{if (NF == 2) print $NF}' |
xargs sudo git rm -r

git st | awk '{if (NF==1) print $1}'|xargs sudo git add -A

sudo git ci -m "${msg}"

sudo git push

echo "git push finished,${msg}"
